import 'package:flutter/material.dart';
import 'package:yysk_app/utils/colors.dart';
import 'package:yysk_app/widget/app_bar_back_widget.dart';
import 'package:yysk_app/widget/app_bar_title_widget.dart';

class DrawerWidget extends StatelessWidget {
  final String title;
  final Widget? leading;
  final Widget? bottomNavigationBar;
  final VoidCallback? onBack;
  final List<Widget>? actions;
  final Widget? child;
  final Color? backgroundColor;
  const DrawerWidget({
    super.key,
    required this.title,
    this.leading,
    this.actions,
    this.child,
    this.onBack,
    this.bottomNavigationBar,
    this.backgroundColor = AppColors.backgroundColor,
  });

  @override
  Widget build(BuildContext context) {
    return Drawer(
      width: MediaQuery.of(context).size.width,
      child: Scaffold(
        appBar: AppBar(
          title: AppBarTitleWidget(
            title: title,
            backgroundColor: backgroundColor,
          ),
          backgroundColor: backgroundColor ?? Colors.transparent,
          leading:
              leading ?? AppBarBackWidget(context: context, onBack: onBack),
          actions: actions ?? [Container()],
          scrolledUnderElevation: 0,
        ),
        body: MediaQuery.removePadding(
          removeLeft: true,
          removeRight: true,
          context: context,
          child: child ?? Container(),
        ),
        bottomNavigationBar: bottomNavigationBar,
      ),
    );
  }
}
